<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>嵌套块元素垂直外边距的塌陷</title>
    <style>
        /* 解决方案： 
            1.父元素定义边框 border: 1px solid transparent;
            2.父元素定义内边距 padding: 1px;
            3.父元素添加 overflow: hidden;
        */
        
        .father {
            width: 300px;
            height: 300px;
            margin-top: 50px;
            /* border: 1px solid transparent; */
            /* padding: 1px; */
            overflow: hidden;
            background-color: blueviolet;
        }
        
        .son {
            width: 100px;
            height: 100px;
            margin-top: 100px;
            background-color: coral;
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: normal;
        }
    </style>
</head>

<body>
    <div class="father">
        <div class="son">55555555666666666</div>
    </div>


</body>

</html>